﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Purchase.ApiS.ListDisplay.Command;
using Purchase.ErrorCode;
using Purchase.ApiS.Dto;
using Purchase.Domian.Model;
using Purchase.ApiS.AllCation.Command.Quality;
using ProductIntory.Domains;
using System.Xml.Linq;
using Purchase.ApiS.ListDisplay.Command.Supplier;

namespace Purchase.ApiS.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SupplierController : ControllerBase
    {
        public readonly IMediator mediator;

        public SupplierController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 供应商列表展示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult<SupplierModel>> GetSupplierList([FromQuery]GetSupplierCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 获取物料信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<MaterialInfo>> GetMaterialInfo([FromQuery]GetMaterialInfoCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 质检信息的列表展示方法
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<QualityDto>>> GetQulityInfo([FromQuery]GetQulityCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取检验部门信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<InspectionDep>>> GetInspectionDepInfo([FromQuery]GetInspectionDepCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 质检人员的列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<ApiResult<QualityInspectionModel>> GetUserInfo([FromQuery]GetUserCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取采购信息列表方法
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<MaterialInfo>> GetPurchasedMaterials([FromQuery]PurchasedMaterialsCommand request)
        {
            return mediator.Send(request);
        }



    }
}
